<!DOCTYPE html>
<html>
<#include "../head.html">
    <body class="full">
        <div class="mc">
            <div class="mc-l"></div>
            <div class="mc-m"></div>
            <div class="mc-r"></div>
        </div>
        <div class="mc-b"><#include "../foot.html"></div>




    <table class="mc">
        <tr>
            <td class="mc-l">
                <!--左侧导航---{-->
                <div id="navPanelContainer">
                    <div class="system-logo cd"></div>
                    <!--管理员信息---{-->
                    <#include "../adminInfo.html">
                        <!--管理员信息---}-->
                        <div class="nav-wrap">
                            <#include "leftForRechargeAndCash.html">
                        </div>
                </div>
                <!--左侧导航---}-->
            </td>
            <td class="mc-m">
                <div class="navToggle"></div>
            </td>
            <td class="mc-r">
                <!--顶部导航---{-->
                <#include "../topNav.html">
                    <!--顶部导航---}-->

                    <!--面包屑导航---{-->
                    <#assign moduleName="提现">
                        <#include "banner.html">
                            <!--面包屑导航---}-->

                            <!--工具栏--{-->
                            <div id="toolbar" class="clearfix">

                            </div>
                            <!--工具栏--}-->

                            <div id="main" class="val clearfix">
                             <div class="valBox w750">
                            	<form name="form1" method="post" action="/admin/account/franchiseeBorrowCash.html"  enctype="multipart/form-data" >
                          
                                <ul>
                                  	<li>
                                          <div class="title">提现用户:</div>
                                          <div class="v"> 
                                          	<#if cashUser??> ${cashUser.realName!}</#if>
                                            <input type="hidden" id="userPhone" name="userPhone" value="<#if cashUser??>${cashUser.phone!}</#if>">
                                          </div>
                                      </li>
                                      <li>
                                          <div class="title">可提现金额:</div>
                                          <div class="v"> 
                                          	<#if cashUserAccount??> ${(allowCash!0)?c}<#else>0</#if>元(<#if cashUserAccount??>可用：${(cashUserAccount.balance!0)?c}, 冻结：${(cashUserAccount.freeze!0)?c}<#else></#if>)
                                          </div>
                                      </li>
                                      <li>
                                          <div class="title">提现金额：</div>
                                          <div class="v"> 
                                          	  <input type="text" name="cashMoney" id="cashMoney" autocomplete="off" onkeyup="value=value.replace(/[^0-9.]/g,'')">(可提现范围：<#if cashUserAccount??> 1~ ${(allowCash!0)?c}<#else>0</#if>)
                                          </div>
                                      </li>
                                      <li>
                                          <div class="title">确认金额：</div>
                                          <div class="v"> 
                                          	  <input type="text" name="cashMoney" id="rcashMoney" autocomplete="off" onkeyup="value=value.replace(/[^0-9.]/g,'')">
                                          </div>
                                      </li>
                                       <li>
                                          <div class="title">验  证  码：</div>
                                          <div class="v">
                                              <input autocomplete="off" class="authcode" id="validCode" name="validCode" placeholder="请输入短信验证码" type="text">
                                              <input id="verify_btn" class="verify_btn" autocomplete="off" value="获取短信验证码" type="button">
                                          </div>

                                      </li>
                                  </ul>
                                  <div class="other">
                                      <input type="hidden"  name="actionType" value="recharge" />
                                      <input type="submit"  value="确定提现" class="input-button confirm"  onclick ="return valid();"/>
                                  </div>
                                    </form>
                                </div>
                            </div>

            </td>
        </tr>
        <tr>
            <!--尾部--{-->
            <td colspan="3" class="mc-b"><#include "../foot.html"></td>
            <!--尾部--}-->
        </tr>
    </table>
<script type="text/javascript">
   function valid(){
     var cashMoney = document.getElementById("cashMoney").value;
     var rcashMoney = document.getElementById("rcashMoney").value;
     var validCode = $("#validCode").val();
     if(rcashMoney!=cashMoney){
        alert("金额不一致！");
        return false;
     }else{
      if(parseInt(cashMoney)>5000000){
        alert("提现金额不能超过500,0000！");
        return false;
     }
      if(validCode==""){
        alert("请输入短信验证码");
        return false;
      }
        if(confirm("请确认您的提现金额："+cashMoney+"元")){
          return true;
        }else{
          return false;
        }
     }
   }
   //发送手机验证码
   $("#verify_btn").click(function(){
     var cashMoney = document.getElementById("cashMoney").value;
     var rcashMoney = document.getElementById("rcashMoney").value;
     if(rcashMoney==""||cashMoney==""){
        alert("请填写金额！");
        return false;
     }
     if(rcashMoney!=cashMoney){
        alert("金额不一致！");
        return false;
     }
     if(parseInt(cashMoney)>5000000){
        alert("提现金额不能超过500,0000！");
        return false;
     }
     getMobileCode(); //获取验证码
     $.cookie(COOKIE_VERIFY,30, {
         path: '/',
         expires: 30
     });
     time();
 });
    
     /*

         * 手机校验码
         */
        function getMobileCode(){
          $.ajax({
                 url:"/admin/account/cashPhoneCode.html",
                 type:"post",
                 data:"token="+$("#userPhone").val()+"&cashMoney="+$("#cashMoney").val(),
                 dataType:"json",
                 async:false,
                 success:function(data){
                     if(data.resultCode==0){
                      alert(data.resultMsg);
                     }
            
                 },
                 timeout:50000,
                 error:function(){
                     alert("请求超时");
                 }
             });
         }
          var COOKIE_VERIFY = 'photoVerify'; 
//判断cookie是否存在
        if ($.cookie(COOKIE_VERIFY)) { //刷新后还可以正确显示倒计时
            time();
            alert(1);
        } 
        //秒倒计时
        function time() {

            var tmpWait = $.cookie(COOKIE_VERIFY);
            if ($.cookie(COOKIE_VERIFY)) {
                $("#verify_btn").attr("disabled", true);
                $("#verify_btn").val(tmpWait + "秒后重新获取");
                --tmpWait;
                $.cookie(COOKIE_VERIFY, tmpWait, {
                    path: '/',
                    expires: 10
                });
                if (tmpWait == 0) {
                    $.cookie(COOKIE_VERIFY, null, {
                        path: '/'
                    }); //删除cookie  
                }
                setTimeout(function() {
                        time();
                    },
                    1000)
            } else {
                $("#verify_btn").removeAttr("disabled");
                $("#verify_btn").val("获取手机验证码");
            }
        } 
         
</script>

    </body>
</html>
<#include "../jsPage.html">
